package hotel.menu.adapter;

import hotel.menu.domain.School;
import java.util.List;
import com.example.youknow.R;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class Item2SchoolAdapter extends BaseAdapter {
	Context context;
	LayoutInflater layoutInflater;
	List<School> schools;
	public int foodpoition;

	public Item2SchoolAdapter(Context context, List<School> schools, int position) {
		this.context = context;
		this.schools = schools;
		layoutInflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.foodpoition = position;
	}

	@Override
	public int getCount() {
		return schools.size();
	}

	@Override
	public Object getItem(int position) {
		return getItem(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder = null;
		if (convertView == null) {
			convertView = layoutInflater.inflate(R.layout.item2_school_item, null);
			viewHolder = new ViewHolder();
			viewHolder.textView = (TextView) convertView
					.findViewById(R.id.textview2);
			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		viewHolder.textView.setText(schools.get(position).getSchoolname());
		viewHolder.textView.setTextColor(Color.BLACK);

		return convertView;
	}

	public static class ViewHolder {
		public TextView textView;
	}

}
